<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateGoodsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('goods', function(Blueprint $table)
		{
			$table->integer('id', true)->comment('商品主键');
			$table->string('goods_name', 100)->nullable()->comment('商品名称');
			$table->string('goods_thumbnail', 200)->nullable()->comment('商品缩略图');
			$table->decimal('cost_price', 10)->nullable();
			$table->decimal('repeat_price', 10)->nullable()->comment('复购价格');
			$table->integer('stock')->nullable()->default(0)->comment('库存');
			$table->text('detail', 65535)->nullable()->comment('商品详情');
			$table->text('slide', 65535)->nullable()->comment('轮播图');
			$table->integer('sale_num')->nullable()->comment('已销售商品数量，以此为目标判断商品是否热卖');
			$table->integer('is_recommend')->nullable()->comment('是否推荐');
			$table->string('sale_start_time', 100)->nullable()->comment('销售开始时间');
			$table->string('sale_end_time', 100)->nullable();
			$table->timestamps();
			$table->integer('is_sale')->nullable()->default(0)->comment('0 上架 1 下架');
			$table->string('send_time', 100)->nullable()->comment('发货时间');
			$table->integer('send_day')->nullable()->default(0)->comment('预计几天后发货');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('goods');
	}

}
